#include<bits/stdc++.h>
using namespace std;
int t;
int n,m,L;
double V;
int d[100010],v[100010],a[100010];
int p[100010];
int ans1,ans2;
double shunshi(int x){
    int nn;
    double s=(double)(p[1]-d[x]);
    if((double)(v[x]*v[x])+2.0*((double)a[x])*s<0) return 0.0;
    else if(a[x]>0.0) return sqrt((double)(v[x]*v[x])+2.0*((double)a[x])*s);
    else {
        for(int i=m;i>=1;i--) if(p[m]>d[x]) {
            nn=p[m]-d[x];
            break;
        }
        s=(double)nn;
        return sqrt((double)(v[x]*v[x])+2.0*((double)a[x])*s);
    }
}
bool cmp(int x,int y){
    return x>y;
}
signed main(){
    freopen("detect.in","r",stdin);
    freopen("detect.out","w",stdout);
    cin>>t;
    cin>>n>>m>>L>>V;
    for(int i=1;i<=n;i++){
        cin>>d[i]>>v[i]>>a[i];
    }
    for(int i=1;i<=m;i++){
        cin>>p[i];
    }
    sort(p+1,p+1+m,cmp);
    for(int i=1;i<=n;i++){
        cout<<shunshi(i)<<endl;
        if(shunshi(i)>V) ans1++;
        //if(workout(i)>V) ans2++;
    }
    cout<<ans1<<" "<<ans1<<endl;
    return 0;
}